package com.huan;

import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;

import java.io.IOException;



//测试
public class OptimizeAPI {

    //判断表是否存在
    public static boolean isTable(String name) throws IOException {
        //拿到管理员对象
        Admin admin = Call.admin;
        //调用tableExists方法获取表名
        boolean exists = admin.tableExists( TableName.valueOf( name ) );
        //返回结果
        return exists;
    }


    public static void main(String[] args) throws IOException {
        //获取
        boolean stu = isTable( "stu" );
        System.out.println(stu);
        //关闭资源
        Call.close();
    }
}
